// FullscreenMixin.js
export default {
  data() {
    return {
      // 是否全屏
      isFullScreen: false

    }
  },
  created() {
    this.$socket.registerCallback('fullScreen' + this.$options.name, this.changeFullScreenByWs)
  },
  destroyed() {
    this.$socket.unRegisterCallback('fullScreen')
  },
  methods: {
    changeFullScreen() {
      this.isFullScreen = !this.isFullScreen;
      this.$socket.send({
        action: 'fullScreen',
        socketType: 'fullScreen',
        chartName: this.$options.name,
        value: this.isFullScreen
      })
      this.$nextTick(() => {
        this.adaptScreen();
      })
    },
    changeFullScreenByWs(data = null) {
      this.isFullScreen = data.value;
      this.$nextTick(() => {
        this.adaptScreen();
      })
    }
  }
};
